package exception;

public class TryCatchDemo2 {
    public static void main(String[] args) {
        System.out.println("程序开始");
        try{
            String str = "sgsdjfygiufwon";
            System.out.println(str.length());
            System.out.println(str.charAt(5));
            System.out.println(Integer.parseInt(str));
        }catch(NullPointerException|StringIndexOutOfBoundsException e){
            System.out.println("空指针异常或字符串索引越界异常");
        }catch(Exception e){
            System.out.println("出现了未知异常");
        }
        System.out.println("程序结束");
    }
}
